package com.test.restaurant.admin.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.test.restaurant.pojo.DishTable;
import com.test.restaurant.service.DishTableService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 徒有琴
 */
@Controller
public class DishTableController {
    @Reference//dubbo注解
    private DishTableService dishTableService;
    @RequestMapping("index.html")
    public String index(){
        return "index";
    }
    @RequestMapping("/detail/{page}.html")
    public String page(@PathVariable String page){
        return "/"+page;
    }
    @RequestMapping("dish_table.html")
    public String tables(String name, Model model) {
        List<DishTable> tables=dishTableService.getTableList(name);
        model.addAttribute("tables",tables);
        return "tables";
    }
}
